package com.wmx.reddoor.jpa.controller;

import com.alibaba.druid.stat.DruidStatManagerFacade;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * druid 数据源监控信息
 *
 * @author wangMaoXiong
 * @version 1.0
 * @date 2022/3/15 14:44
 */
@RestController
public class DruidController {

    /**
     * 获取 druid 数据监控信息
     * http://127.0.0.1:8080/myDruid/stat
     *
     * @return
     */
    @GetMapping("myDruid/stat")
    public List<Map<String, Object>> druidStat() {
        List<Map<String, Object>> statDataList = DruidStatManagerFacade.getInstance().getDataSourceStatDataList();
        return statDataList;
    }
}
